  @RequestMapping("/exportExcel")
    public void exportExcel(HttpSession session, HttpServletResponse response) {

        //创建一个工作空间---对应一个excel表
        HSSFWorkbook workbook = new HSSFWorkbook();
        //创建一个sheet
        HSSFSheet sheet = workbook.createSheet();
        //创建单元格样式
        HSSFCellStyle cellStyle = workbook.createCellStyle();
        cellStyle.setAlignment(HorizontalAlignment.CENTER);
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);

        //创建字体
        HSSFFont font = workbook.createFont();
        //设置颜色
        font.setColor(HSSFColor.RED.index);
        //设置粗体
        font.setBold(true);


        //合并单元格
        List<String> cells = Arrays.asList("所在村（社区）", "健康观察负责人（卫生院填写）", "社区（村）负责人", "核酸检测情况");
        List<String> headNames = Arrays.asList("日期", "姓名", "性别", "年龄", "联系电话",
                "第二联系电话", "身份证号码", "区（市）县", "镇（街道）", "村（社区）", "市内详细居住地",
                "户籍所在地", "近14天旅居史、接触史情况", "抵蓉时间", "从何处抵蓉（xx市xx区xx街道）",
                "居家隔离医学观察开始时间（卫生院填写）", "排查方式", "姓名", "联系电话（手机）",
                "姓名", "联系电话（手机）", "观察结果（卫生院填写）", "备注", "是否持有有效核酸报告",
                "核酸检测时间", "核酸检测地点，医院名称", "核酸结果", "预计解除时间");
        List<String> headNames2 = Arrays.asList("市内详细居住地",
                "户籍所在地", "近14天旅居史、接触史情况", "抵蓉时间", "从何处抵蓉（xx市xx区xx街道）",
                "居家隔离医学观察开始时间（卫生院填写）", "排查方式");

        //创建一行
        //第一行
        HSSFRow row0 = sheet.createRow(0);
        HSSFCell cell0_0 = row0.createCell(0);
        cell0_0.setCellValue("中高风险地区及境外来返双人员疫情防控摸排健康监测表");
        cell0_0.setCellStyle(cellStyle);

        //合并 标题--单元格
        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 27));
        //第二行
        HSSFRow row1 = sheet.createRow(1);
        //第二行-1-7列 （日期  到  身份证号）
        for (int i = 0; i < 7; i++) {
            HSSFCell cell = row1.createCell(i);
            cell.setCellValue(headNames.get(i));
            cell.setCellStyle(cellStyle);
            //合并单元格
            sheet.addMergedRegion(new CellRangeAddress(1, 2, i, i));
        }
        //所在村（社区）

        //合并 所在村（社区）
        sheet.addMergedRegion(new CellRangeAddress(1, 1, 7, 9));

        HSSFCell cell1_7 = row1.createCell(7);
        cell1_7.setCellValue("所在村（社区）");
        HSSFRow row2 = sheet.createRow(2);
        HSSFCell cell2_7 = row2.createCell(7);
        cell2_7.setCellValue("区（市）县");
        HSSFCell cell2_8 = row2.createCell(8);
        cell2_8.setCellValue("镇（街道）");
        HSSFCell cell2_9 = row2.createCell(9);
        cell2_9.setCellValue("村（社区）");

        //第二行-11-17列 （市内详细居住地  到  排查方式）---差两列？
        for (int i = 10; i < 17; i++) {
            HSSFCell cell = row1.createCell(i);
            cell.setCellValue(headNames2.get(i - 10));
            cell.setCellStyle(cellStyle);
            //合并单元格
            sheet.addMergedRegion(new CellRangeAddress(1, 2, i, i));
        }

        //健康观察负责人（卫生院填写）
        HSSFCell cell1_15 = row1.createCell(17);
        cell1_15.setCellValue("健康观察负责人（卫生院填写）");
        cell1_15.setCellStyle(cellStyle);
        //姓名
        HSSFCell cell2_17 = row2.createCell(17);
        cell2_17.setCellValue("姓名");
        cell2_17.setCellStyle(cellStyle);
        //联系电话（手机）
        HSSFCell cell2_18 = row2.createCell(18);
        cell2_18.setCellValue("联系电话（手机）");
        cell2_18.setCellStyle(cellStyle);

        //社区（村）负责人
        HSSFCell cell1_16 = row1.createCell(19);
        cell1_16.setCellValue("社区（村）负责人");
        cell1_16.setCellStyle(cellStyle);
        //姓名
        HSSFCell cell2_19 = row2.createCell(19);
        cell2_19.setCellValue("姓名");
        cell2_19.setCellStyle(cellStyle);
        //联系电话（手机）
        HSSFCell cell2_20 = row2.createCell(20);
        cell2_20.setCellValue("联系电话（手机）");
        cell2_20.setCellStyle(cellStyle);

        //观察结果
        HSSFCell cell2_21 = row1.createCell(21);
        cell2_21.setCellValue("观察结果（卫生院填写）");
        cell2_21.setCellStyle(cellStyle);

        //备注
        HSSFCell cell2_22 = row1.createCell(22);
        cell2_22.setCellValue("备注");
        cell2_22.setCellStyle(cellStyle);


        //核算检测情况
        HSSFCell cell1_19 = row1.createCell(23);
        cell1_19.setCellValue("核酸检测情况");
        cell1_19.setCellStyle(cellStyle);

        HSSFCell cell2_23 = row2.createCell(23);
        cell2_23.setCellValue("是否持有有效核酸报告");
        cell2_23.setCellStyle(cellStyle);

        HSSFCell cell2_24 = row2.createCell(24);
        cell2_24.setCellValue("核酸检测时间");
        cell2_24.setCellStyle(cellStyle);

        HSSFCell cell2_25 = row2.createCell(25);
        cell2_25.setCellValue("核酸检测地点，医院名称");
        cell2_25.setCellStyle(cellStyle);

        HSSFCell cell2_26 = row2.createCell(26);
        cell2_26.setCellValue("核酸结果");
        cell2_26.setCellStyle(cellStyle);

        //合并单元格
        sheet.addMergedRegion(new CellRangeAddress(1, 2, 21, 21));

        sheet.addMergedRegion(new CellRangeAddress(1, 2, 22, 22));
        //合并 健康观察负责人（卫生院填写）
        sheet.addMergedRegion(new CellRangeAddress(1, 1, 17, 18));
        //合并 社区（村）负责人
        sheet.addMergedRegion(new CellRangeAddress(1, 1, 19, 20));
        //合并 核酸检测情况
        sheet.addMergedRegion(new CellRangeAddress(1, 1, 23, 26));

        HSSFCell cell2_27 = row2.createCell(27);
        cell2_27.setCellValue("预计解除时间");
        cell2_27.setCellStyle(cellStyle);


        OutputStream outputStream = null;
        try {
            outputStream = response.getOutputStream();
            response.reset();
            response.setContentType("application/vnd.ms-excel");
            response.setHeader("Content-disposition", "attachment;filename=template.xls");
            workbook.write(outputStream);
            outputStream.flush();
            outputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }